public class Grade {

    //学生信息
    private Student student;

    //课程信息
    private Course course;

    //分数：平时分数，期末分数，总评分数
    private double usualScore;
    private double finalScore;
    private double totalScore;


    public Grade() {
    }

    public Grade(Student student, Course course, double usualScore, double finalScore) {
        this.student = student;
        this.course = course;
        this.usualScore = usualScore;
        this.finalScore = finalScore;
        //总评成绩如何得到？
        calculateTotalScore();
    }

    private void calculateTotalScore() {
        this.totalScore = usualScore * 0.4 + finalScore * 0.6;
    }

    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public double getUsualScore() {
        return usualScore;
    }

    public void setUsualScore(double usualScore) {
        this.usualScore = usualScore;
    }

    public double getFinalScore() {
        return finalScore;
    }

    public void setFinalScore(double finalScore) {
        this.finalScore = finalScore;
    }

    public double getTotalScore() {
        return totalScore;
    }

    @Override
    public String toString() {
        return String.format("学生：%S 课程：%S 平时分：%.1f 期末分：%.1f 总评分：%.1f", student.getName(), course.getCourseName(), usualScore, finalScore, totalScore);
    }
}
